package com.tian.common.enums;

import lombok.Getter;

/**
 * {@code @description:} TODO
 *
 * @author tianwc 公众号：Java后端技术全栈
 * 在线刷题 1200+java面试题和1000+篇技术文章：<a href="https://woaijava.cc/">博客地址</a>
 * {@code @date:} 2025-03-06 19:32
 * {@code @version:} 1.0
 */
@Getter
public enum ChargingSpeedType {
    //0：快充
    FAST_CHARGING(0, "快充"),
    //1：慢充
    SLOW_CHARGING(1, "慢充"),
    //2：混合充电
    MIXED_CHARGING(2, "混合充电");
    private final int speed;
    private final String description;

    ChargingSpeedType(int speed, String description) {
        this.speed = speed;
        this.description = description;
    }

    public static ChargingSpeedType getBySpeed(int speed) {
        for (ChargingSpeedType type : ChargingSpeedType.values()) {
            if (type.getSpeed() == speed) {
                return type;
            }
        }
        return null;
    }
}
